package com.prs.crm.service.archives.impl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import com.prs.crm.dao.archives.ArchivesManagerDao;
import com.prs.crm.domain.archives.ArchivesManager;
import com.prs.crm.domain.archives.ArchivesType;
import com.prs.crm.service.archives.ArchivesManagerService;
import com.prs.crm.service.impl.BaseServiceImpl;

public class ArchivesManagerServiceImpl extends BaseServiceImpl<ArchivesManager, ArchivesManagerDao> implements ArchivesManagerService{

	@Override
	public List<ArchivesManager> getAllArchivesManager() {
		return this.getDao().getAllArchivesManager();
	}

	@Override
	public Collection<ArchivesType> convertToArchivatesType(String ids) {
		try{
			Collection<ArchivesType> archivesTypes=new ArrayList<ArchivesType>();
			for (String id : ids.split(",")) {
				ArchivesType archivesType=new ArchivesType();
				archivesType.setId(Integer.parseInt(id));
				archivesTypes.add(archivesType);
			}
			return archivesTypes;
		}catch (NumberFormatException e) {
			e.printStackTrace();
			return null;
			}
		}

	@Override
	public ArchivesManager getArchivesManager(String name) {
		return this.getDao().getArchivesManager(name);
	}

	@Override
	public ArchivesManager getArchivesManagers(Integer[] id) {
		return this.getDao().getArchivesManagers(id);
	}

	@Override
	public ArchivesManager getaArchivesManagers1(Integer id) {
		return this.getDao().getaArchivesManagers1(id);
	}
}
